<template>
    <el-container class="home">
        
        <el-header>
            <div>宿舍管理系统</div>
            <div>
                <span>{{tname}}</span>
                <span @click="exit" class="el-icon-switch-button"></span>
            </div>
        </el-header>

        <el-container v-if="type===1">
            <el-aside>
                <el-menu 
                    :router="true"
                    default-active="1" class="el-menu-vertical-demo">
                    <el-menu-item index="/home/noticehome">
                        <i class="el-icon-menu"></i>
                        <span slot="title">公告主页</span>
                    </el-menu-item>
                    <el-menu-item index="/home/student">
                        <i class="el-icon-menu"></i>
                        <span slot="title">学生管理</span>
                    </el-menu-item>
                    <el-menu-item index="/home/dorm">
                        <i class="el-icon-menu"></i>
                        <span slot="title">宿舍管理</span>
                    </el-menu-item>
                    <el-menu-item index="/home/notice">
                        <i class="el-icon-menu"></i>
                        <span slot="title">公共管理</span>
                    </el-menu-item>
                    <el-menu-item index="/home/admin">
                        <i class="el-icon-menu"></i>
                        <span slot="title">管理员管理</span>
                    </el-menu-item>
                </el-menu>
            </el-aside>
            <el-main>
                <RouterView></RouterView>
            </el-main>
        </el-container>
        <el-container v-else-if="type===0">
            <el-aside>
                <el-menu 
                    :router="true"
                    default-active="1" class="el-menu-vertical-demo">
                    <el-menu-item index="/home/noticehome">
                        <i class="el-icon-menu"></i>
                        <span slot="title">公告主页</span>
                    </el-menu-item>
                    <el-menu-item index="/home/student">
                        <i class="el-icon-menu"></i>
                        <span slot="title">学生管理</span>
                    </el-menu-item>
                    <el-menu-item index="/home/dorm">
                        <i class="el-icon-menu"></i>
                        <span slot="title">宿舍管理</span>
                    </el-menu-item>
                    <el-menu-item index="/home/notice">
                        <i class="el-icon-menu"></i>
                        <span slot="title">公共管理</span>
                    </el-menu-item>
                   
                </el-menu>
            </el-aside>
            <el-main>
                <RouterView></RouterView>
            </el-main>
        </el-container>
        <el-container v-else-if="type===undefined ">
            <el-aside>
                <el-menu 
                    :router="true"
                    default-active="1" class="el-menu-vertical-demo">
                    <el-menu-item index="/home/noticehome">
                        <i class="el-icon-menu"></i>
                        <span slot="title">公告主页</span>
                    </el-menu-item>
                   
                    <el-menu-item index="/home/dorm">
                        <i class="el-icon-menu"></i>
                        <span slot="title">宿舍管理</span>
                    </el-menu-item>
                   
                   
                </el-menu>
            </el-aside>
            <el-main>
                <RouterView></RouterView>
            </el-main>
        </el-container>
    </el-container>
</template>
<script>
let user = JSON.parse(sessionStorage.getItem("user"));
export default{
    data(){
        return{ 
            type:user.t_type,
            tname:user.t_name,
            tusername:user.t_username,
            tpassword:user.t_password,
            turl:user.t_url
        
        
        }
    },
    methods:{
        exit(){
            
            this.$router.push('/login')
        },
        change(){
            
        }
    },
    mounted:function(){
        
        
    }
}
</script>

<style scoped lang="less">
.home {
    height: 100%;

    .el-header {
        height: 50px;
        background: #eee;
        line-height: 50px;
        div:nth-child(1){
            float: left;
        }
        div:nth-child(2){
            float: right;

            span{
                padding-left: 50px; 
            }
        }
    }

    .el-aside {
        width: 188px !important;
        background: #999;

        .el-menu{
            height: 100%;
        }
    }

    .el-main {
        
    }
}
</style>